package com.itheima.map;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

public class Demo04 {

    public static void main(String[] args) {
        Map<String,String> map= new HashMap<>();
        map.put("马蓉","宝强");
        map.put("马蓉","宋喆");
        map.put("小美","宝强");
        map.put("小璐","乃亮");
        map.put("小璐","PGone");
        map.put("anglebaby","小明");

        //获取到所有的键值对组合
        Set<Map.Entry<String,String>> entries = map.entrySet();


        entries.forEach(entry-> System.out.println(entry.getKey()+"####"+entry.getValue()));


        for (Map.Entry<String, String> entry : entries) {
            System.out.println(entry.getKey()+"@@@@"+entry.getValue());
        }
        Iterator<Map.Entry<String, String>> iterator = entries.iterator();
        while (iterator.hasNext()){
            Map.Entry<String, String> entry = iterator.next();
            System.out.println(entry.getKey()+"$$$$"+entry.getValue());
        }
    }
}
